package com.atguigu.java.ai.langchain4j.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

/**
 * @Author: Mikey
 * @Date: 2025/9/4 15:08
 * @Description:
 **/
@Component
public class CalculatorTools {


    @Tool(name = "加法运算",value = "用于返回两个加数的和")
    public double sum(@ToolMemoryId int memoryId,
                      @P(value = "参数1" ,required = true) double a,
                      @P(value = "参数2",required = true) double b){
        System.out.println("加法运算");
        //调用加法运算
        return a+b;
    }

    @Tool(name = "减法运算",value = "计算两个数的差值")
    public int modulaArithmetic(@ToolMemoryId int memoryId,
                                @P(value = "参数1")int a,
                                @P(value = "参数2") int b){
        System.out.println("模运算");
          return a%b;

    }
}
